import type { App } from "vue";
import { createRouter, createWebHashHistory, RouteRecordRaw } from "vue-router";
import importantNews from "../pages/importantNews/importantNews.vue";
import noticeNews from "../pages/noticeNews/noticeNews.vue";
import dwStory from '../pages/dwStory/dwStory.vue'
import vanguardPositionVue from "@/pages/vanguardPosition/vanguardPosition.vue";
import wokerBench from '@/pages/wokerBench/wokerBench.vue'
import drivingCabin from "@/pages/drivingCabin/drivingCabin.vue";
import organizeActive from '@/pages/organizeActive/organizeActive.vue'
import cleanPartyVue from "@/pages/cleanParty/cleanParty.vue";
import newsDetailVue from "@/pages/newsDetail/newsDetail.vue";
import payVue from "@/pages/pay/pay.vue";
import { createGuard } from "./guard";
import dwgsLisVue from "@/pages/dwgsList/dwgsList.vue";
import notFound from '@/pages/notFound/notFound.vue'
import payResVue from "@/pages/payRes/payRes.vue";
import payDetailVue from "@/pages/payDetail/payDetail.vue";
const routes: RouteRecordRaw[] = [
  { path: "/important-news", component: importantNews, meta: { requiresAuth: true, title: "党建要闻" } },
  { path: "/notice-news", component: noticeNews, meta: { requiresAuth: true, title: "通知发文" } },
  { path: "/dw-story", component: dwStory, meta: { requiresAuth: true, title: "东吴故事" } },
  { path: "/vangurad-position", component: vanguardPositionVue, meta: { requiresAuth: true, title: "两优一先" } },
  { path: "/", component: wokerBench, meta: { requiresAuth: true, title: "工作台" } },
  { path: "/driving-cabin", component: drivingCabin, meta: { requiresAuth: true, title: "驾驶舱" } },
  { path: "/organize-active", component: organizeActive, meta: { requiresAuth: true, title: "组织生活" } },
  { path: "/clean-party", component: cleanPartyVue, meta: { requiresAuth: true, title: "廉洁党务" } },
  { path: "/news-detail/:id", component: newsDetailVue, meta: { requiresAuth: true, title: "" } },
  { path: "/pay", component: payVue, meta: { requiresAuth: true, title: "党费缴纳" } },
  { path: "/dwgs-list/:type", component: dwgsLisVue, meta: { requiresAuth: true, title: "东吴故事" } },
  { path: "/not-found", component: notFound, meta: { requiresAuth: false, title: "" } },
  { path: "/pay-res", component: payResVue, meta: { requiresAuth: false, title: "党费缴纳" } },
  { path: "/pay-detail", component: payDetailVue, meta: { requiresAuth: true, title: "党费缴纳" } },
];



const router = createRouter({
  history: createWebHashHistory(),
  routes,
});

export function setupRouter(app: App<Element>) {
  app.use(router);
  createGuard(router);
}

export default router;
